03. Rotation Matrices in 2D

Rotation Matrices in 2D

Rotation matrices have two conceptual, but mathematically equivalent, interpretations. They can be viewed as a means of "expressing" a vector in one coordinate frame in terms of some other coordinate frame. This interpretation is known as a “mapping” between frames.

Alternatively, a rotation matrix can be seen as an “operator” that actually moves a vector within a single coordinate frame. It is important to be aware of this conceptual distinction because the particular application will dictate which description is used, but do not let it confuse you: it’s the same math!

Let’s again consider a vector, v, with respect to reference frames A and B and take a more formal look at how to express v, whose measure numbers we may know in frame A, in terms of frame B.

\mathbf{v = v_{x}\hat{a}_{x} + v_{y}\hat{a}_{y} = u_{x}\hat{b}_{x} + u_{y}\hat{b}_{y}}
(1)

If we dot equation (1) with \bold{\hat{a}_x} we get:

\mathbf{v \ . \ \hat{a}_{x} = v_{x}\hat{a}_{x} \ . \ \hat{a}_{x} + v_{y}\hat{a}_{x} \ . \ \hat{a}_{y} = u_{x}\hat{a}_{x} \ . \ \hat{b}_{x} + u_{y}\hat{a}_{x} \ . \ \hat{b}_{y}}
(2)

Since \bold{\hat{a}_x} and \bold{\hat{a}_y} are orthogonal unit vectors so \bold{\hat{a}_x} \cdot \bold{\hat{a}_x}=1
and \bold{\hat{a}_x} \cdot \bold{\hat{a}_y}=0 so equation (2) simplifies to:

\mathbf{v_{x}= u_{x}\hat{a}_{x} \ . \ \hat{b}_{x}+ u_{y}\hat{a}_{x} \ . \ \hat{b}_{y}}
(3)

Similarly, if we dot equation (1) with \bold{\hat{a}_{y}} and simplify, we get

\mathbf{v_{y}= u_{x}\hat{a}_{y} \ . \ \hat{b}_{x}+ u_{y}\hat{a}_{y} \ . \ \hat{b}_{y}}
(4)

We can arrange equations (3) and (4) into a more compact matrix form,

\mathbf{\begin{bmatrix} v_{x} \\ v_{y} \end{bmatrix} = \begin{bmatrix} \hat{a}_{x} \ . \ \hat{b}_{x} & \hat{a}_{x} \ . \ \hat{b}_{y}\\ \hat{a}_{y} \ . \ \hat{b}_{x} & \hat{a}_{y} \ . \ \hat{b}_{y} \end{bmatrix} \begin{bmatrix} u_{x}\\ u_{y} \end{bmatrix}}
(5)

Rotation in 2D

Which of the following equations would you obtain by simplifying equation (5) after solving for the dot products?

SOLUTION:
\begin{bmatrix} v_{x} \\ v_{y} \end{bmatrix} = \begin{bmatrix} cos(\theta) & -sin(\theta)\\ sin(\theta) & cos(\theta) \end{bmatrix} \begin{bmatrix} u_{x}\\ u_{y} \end{bmatrix}

The first term on the right-hand side of the equality in equation (5) is known as a rotation matrix and is generally written in a more compact form, ^{a}_{b}{R} .

Examining the columns of the rotation matrix, you can see that they are in fact the basis vectors of frame B expressed in terms of the frame A. That is,

\mathbf{_{B}^{A}\textrm{R} = \begin{bmatrix} ^{A}\hat{b}_{x} & ^{A}\hat{b}_{y} \end{bmatrix} = \begin{bmatrix} \hat{a}_{x} \ . \ \hat{b}_{x}& \hat{a}_{x} \ . \ \hat{b}_{y}\\ \hat{a}_{y} \ . \ \hat{b}_{x}&\hat{a}_{y} \ . \ \hat{b}_{y} \end{bmatrix}}
(7)

Looking carefully, you may also notice something else: the rows of ^{a}{b}{R} are the projection of the _A-frame onto B,

\mathbf{_{B}^{A}\textrm{R} = \begin{bmatrix} ^{A}\hat{b}_{x} & ^{A}\hat{b}_{y} \end{bmatrix} = \begin{bmatrix} \hat{a}_{x} \ . \ \hat{b}_{x}& \hat{a}_{x} \ . \ \hat{b}_{y}\\ \hat{a}_{y} \ . \ \hat{b}_{x}&\hat{a}_{y} \ . \ \hat{b}_{y} \end{bmatrix} = \begin{bmatrix} ^{B}\hat{a}_{x} \ ^{T} \\ ^{B}\hat{a}_{y} \ ^{T} \end{bmatrix} }
(8)

This relationship is interesting because it implies that the rotation from A to B is equal to the transpose of the rotation of B to A. In fact, because rotation matrices are orthonormal matrices (composed of orthogonal unit vectors), they have several useful properties that, for the sake of brevity, we summarize without proof.

Important properties of the rotation matrix, ^{A}_{B}{R} :

  1. The transpose is equal to its inverse.

  2. The determinant is equal to +1 (assuming a right-handed coordinate system).

  3. Columns (and rows) are mutually orthogonal unit vectors, therefore, the magnitude of any column (or row) is equal to one and the dot product of any two columns (or rows) is equal to zero

  4. The columns define the basis vectors (i.e., x, y, z axes) of the rotated frame relative to the base frame

Adding one more dimension

So far, we've only considered rotations in two dimensions but the same properties apply to three-dimensional rotations! In three dimensions, the rotation matrix looks like this:

\mathbf{_{B}^{A}\textrm{R} = \begin{bmatrix} ^{A}\hat{b}_{x} & ^{A}\hat{b}_{y} & ^{A}\hat{b}_{z} \end{bmatrix} = \begin{bmatrix} \hat{a}_{x} \ . \ \hat{b}_{x}& \hat{a}_{x} \ . \ \hat{b}_{y}& \hat{a}_{x} \ . \ \hat{b}_{z}\\ \hat{a}_{y} \ . \ \hat{b}_{x}&\hat{a}_{y} \ . \ \hat{b}_{y}& \hat{a}_{y} \ . \ \hat{b}_{z}\\ \hat{a}_{z} \ . \ \hat{b}_{x}&\hat{a}_{z} \ . \ \hat{b}_{y}& \hat{a}_{z} \ . \ \hat{b}_{z} \end{bmatrix} }

Given the properties of rotation matrices listed above, which of the following are valid 3-dimensional rotation matrices?

Which matrices represent valid rotation matrices? (Check all that apply)

SOLUTION:
  • \begin{bmatrix} \frac{\sqrt{3}}{2}& 0 & \frac{-1}{2}\\ 0& 1 & 1 \\ \frac{1}{2}& 0 & \frac{\sqrt{3}}{2} \end{bmatrix}
  • \begin{bmatrix} \frac{\sqrt{1}}{2}& \frac{\sqrt{3}}{2} & 0\\ \frac{-\sqrt{3}}{2}& \frac{\sqrt{1}}{2} & 0\\ 0& 0 & 1 \end{bmatrix}